<template>
	<view class="addlist">
		 <view class="address-item getmain" v-for="(item,index) in addressList" :key='item.id' @click="chooseAddress(item)">
		      <view class="user-view">
		 						  <text>{{item.consignee}}</text>
		 						  <text style="margin-left:30rpx">{{item.mobile}}</text>
		 					  </view>
		 					  <view>
		 						 {{item.area}} {{item.address}}
		 					  </view>
		 </view>
		 <view v-if="addressList.length == 0">
		 	<u-empty
		 	marginTop='100'
		 	text='还没有地址哦'
		    mode="data"
		 	>
		 	</u-empty>
		 </view>
		 <view style="height: 100rpx;">
			 
		 </view>
		 <button class='submites fixBtn' @click="btnSubmit">添加地址</button>
		 <u-modal :show="addshow" title="确定删除吗？"  @cancel='addshow = false' @confirm='confirm' :closeOnClickOverlay="true" showCancelButton confirmColor='#e8565c'>
		 	
		 </u-modal>
	</view>
</template>

<script>
	import {getAddressListApi}  from '@/config/goodApi.js'
	export default {
		data() {
			return {
				addressList:[],
				addshow:false,
				addressId:''
			};
		},
		onShow() {
			this.getAddressList()
		},
		methods:{
			getAddressList(){
				 getAddressListApi({
					 
				 }).then(res=>{
					this.addressList = res.records
				 })
			},
			chooseAddress(e){
				 this.addressId = e.id
				 // this.addshow =true
			},
			btnSubmit(){
			   uni.navigateTo({
			   	url:'/pages/goods/address'
			   })	
			},
			confirm(){
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.addlist{
		// background-color: #f6f6f6;
		height: 100vh;
		padding-top: 20rpx;
	}
 .address-item{
	width: calc(100% - 48rpx);
	margin-bottom: 24rpx;
	margin-left: 24rpx;
    padding: 32rpx;
    background-color: #fff;
    border-radius: 16rpx;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
	
	.user-view{
		margin-bottom: 16rpx;
      display: flex;

    align-items: center;
    font-weight: 500;
    font-size: 28rpx;
    color: #333333;
	}
 }
</style>
